package com.zhou.learn.controller;

import com.zhou.entities.Bill;
import com.zhou.learn.dao.MybatisXmlMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 供应商的控制层
 */
@RestController
public class MybatisXmlController {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private MybatisXmlMapper mybatisAnnotationMapper;

    @GetMapping("/bill/{id}")
    public Bill list(@PathVariable("id") int bid){
        logger.info("账单列表查询。。。。。"+bid);
        Bill bill = mybatisAnnotationMapper.queryBillByPid(bid);
        return bill;
    }

    @GetMapping("/bill")
    public Bill list(Bill bill){
        logger.info("账单列表新增。。。。。");
        mybatisAnnotationMapper.insertBill(bill);
        return bill;
    }

}
